package net.wanho.entity;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

public class Emp {
	private String name; // 姓名
	private Integer age; // 年龄
	private Double salary; // 工资
	private State state; // 状态

	public Emp() {
	}

	public Emp(String name, Integer age, Double salary, State state) {
		this.name = name;
		this.age = age;
		this.salary = salary;
		this.state = state;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

	public Double getSalary() {
		return salary;
	}

	public void setSalary(Double salary) {
		this.salary = salary;
	}

	public State getState() {
		return state;
	}

	public void setState(State state) {
		this.state = state;
	}

	@Override
	public int hashCode() {
		return Objects.hash(age, name, salary, state);
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Emp other = (Emp) obj;
		return Objects.equals(age, other.age) && Objects.equals(name, other.name)
				&& Objects.equals(salary, other.salary) && state == other.state;
	}

	@Override
	public String toString() {
		return "Emp [name=" + name + ", age=" + age + ", salary=" + salary + ", state=" + state + "]";
	}

	/*
	 * 测试数据
	 */
	public static List<Emp> getTestData() {
		List<Emp> list = new ArrayList<>();
		list.add(new Emp("张三", 28, 2300.0, State.FREE));
		list.add(new Emp("李四", 29, 2450.0, State.BUSY));
		list.add(new Emp("王五", 37, 2600.0, State.BUSY));
		list.add(new Emp("赵六", 40, 2300.0, State.VOCATION));
		list.add(new Emp("孙七", 30, 2350.0, State.BUSY));
		list.add(new Emp("aaa", 28, 5000.0, State.BUSY));
		list.add(new Emp("bbb", 20, 2975.0, State.FREE));
		list.add(new Emp("ccc", 24, 2850.0, State.VOCATION));
		list.add(new Emp("ddd", 27, 2450.0, State.FREE));
		list.add(new Emp("eee", 22, 3000.0, State.BUSY));
		list.add(new Emp("fff", 26, 3000.0, State.BUSY));
		list.add(new Emp("ggg", 30, 1600.0, State.FREE));
		list.add(new Emp("hhh", 32, 1250.0, State.VOCATION));
		list.add(new Emp("iii", 29, 1250.0, State.FREE));
		list.add(new Emp("jjj", 26, 1500.0, State.FREE));
		list.add(new Emp("kkk", 28, 950.0, State.VOCATION));
		list.add(new Emp("lll", 33, 1300.0, State.FREE));
		list.add(new Emp("mmm", 35, 1100.0, State.BUSY));
		list.add(new Emp("mmm", 21, 800.0, State.BUSY));
		list.add(new Emp("mmm", 21, 800.0, State.BUSY));
		return list;
	}
}
